//
//  ReleaseView.m
//  AppNew
//
//  Created by 陈名邦 on 2019/6/19.
//  Copyright © 2019 华伟. All rights reserved.
//

#import "ReleaseView.h"

@implementation ReleaseView

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self initViews];
    }
    return self;
    
}

- (instancetype)init{
    
    self = [super init];
    if (self) {
        [self initViews];
    }
    return self;
    
}

- (void)initViews{
    
    _topButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight - 240.f)];
    _topButton.backgroundColor = [UIColor colorWithWhite:0.3 alpha:0.3];
    [_topButton addTarget:self
                   action:@selector(topAction:)
         forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_topButton];
    
    _bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, _topButton.t_bottom, ScreenWidth, 240.f)];
    _bottomView.backgroundColor = [UIColor whiteColor];
    [self addSubview:_bottomView];
    
    _topImageView = [[UIImageView alloc] initWithFrame:CGRectMake(12, 8, 4, 20)];
    _topImageView.backgroundColor = BaseColor;
    [_bottomView addSubview:_topImageView];
    
    _topLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 8, self.t_width - 32.f, 20.f)];
    _topLabel.text = @"发布交易订单";
    [_bottomView addSubview:_topLabel];
    
    _lineView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 36.f, self.t_width, 1)];
    _lineView.backgroundColor = [UIColor lightGrayColor];
    [_bottomView addSubview:_lineView];
    
    _sellButton = [[UIButton alloc] initWithFrame:CGRectMake(self.t_width / 3 - 32.f, _lineView.t_bottom + 24.f, 64.f, 64.f)];
    _sellButton.backgroundColor = [UIColor colorFromHexRGB:@"4EAA92"];
    [_sellButton setTitle:@"出售" forState:UIControlStateNormal];
    [_sellButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [_bottomView addSubview:_sellButton];
    
    _sellLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.t_width * 2 / 3 - 32.f, _sellButton.t_bottom + 4.f, 64.f, 20.f)];
    _sellLabel.font = [UIFont systemFontOfSize:12];
    _sellLabel.textColor = [UIColor darkGrayColor];
    
    _sellLabel.textAlignment = NSTextAlignmentCenter;
    _sellLabel.text = @"在线出售";
    [_bottomView addSubview:_sellLabel];
    
    _buyButton = [[UIButton alloc] initWithFrame:CGRectMake(self.t_width * 2 / 3 - 32.f, _lineView.t_bottom + 24.f, 64.f, 64.f)];
    _buyButton.backgroundColor = [UIColor colorFromHexRGB:@"DF6366"];
    [_buyButton setTitle:@"购买" forState:UIControlStateNormal];
    [_buyButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [_bottomView addSubview:_buyButton];
    
    _buyLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.t_width / 3 - 32.f, _buyButton.t_bottom + 4.f, 64.f, 20.f)];
    _buyLabel.font = [UIFont systemFontOfSize:12];
    _buyLabel.textColor = [UIColor darkGrayColor];
    _buyLabel.textAlignment = NSTextAlignmentCenter;
    _buyLabel.text = @"在线购买";
    [_bottomView addSubview:_buyLabel];
    
    
}

- (void)topAction:(UIButton *)button{
    
    [self removeFromSuperview];
    
}


@end

